package mess;

import com.sun.org.apache.bcel.internal.generic.BREAKPOINT;

import java.util.Arrays;

public class LeeCode_2379 {
    public static void main(String[] args) {
        System.out.println(minimumRecolors("B"
                , 1
        ));
        int[] arr = new int[2];
        arr[0] = 1;
        arr[1] = 2;
        System.out.println(Arrays.toString(Arrays.copyOfRange(arr, 0, 2)));
    }

    private static int minimumRecolors(String blocks, int k) {
        int len = blocks.length();
        if(len == 1 && blocks.charAt(0) == 'B')
            return 0;
        int left = 0;
        int right = 0;
        int min = len;
        while(right <= len - 1 && left <= len - 1){
            while(right - left < k - 1 && right < len - 1){
                right++;
            }
            int count = 0;
            for(int i = left;i <= right;i++){
                if(blocks.charAt(i) == 'W'){
                    count++;
                }
            }
            left++;
            min = Math.min(min, count);
        }
        return min;
    }
}
